<template>
  <div id="app">
    <div>
      <redBox ref="redBox1"
              :msg1="msg"
              :user01="user"></redBox>
      <greenBox @fn1="appAdd($event)"></greenBox>
    </div>
    <button @click="appAdd()">主模版的按钮</button>
    {{user1}}
  </div>
</template>

<script>
import redBox from './components/redBox.vue';
import greenBox from './components/greenBox.vue';

export default {
  name: 'App',
  components: {
    redBox,
    greenBox
  },
  data () {
    return {
      msg: "123",
      user: { name: 'zhangsan', age: 18 },
      user1: {}
    }
  },
  methods: {
    appAdd (data) {
      // this.$refs.redBox1.redAdd();
      console.log("--------appAdd--------", data);
      this.user1 = data
    }
  }
}
</script>

<style lang="less">
#app {
}
</style>
